import Vue from 'vue'

import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
    // 严格模式
    strict:true,
    state: {
        
        name: '能尽快',
        count: 0,
        filtersList: [2, 3, 4, 5, 6, 7, 8, 9, 3, 5],
        student: {
            name: 'tom',
            school: {
                name: '幼儿园',
                address: {
                    city: '广州',
                    street: '珠玑黑马',
                    detail: '天河区'
                }
            }
        }
    },
    mutations: {
        // 第一参数是 state
        // 第二参数是 传过来的参数
        setcount(state, data) {
        state.count += data
        }
    },
    actions: {
        awaitcount(store, num) {
        store.commit('setcount', num)
        }
    },
    getters: {
        getaddr: state => state.filtersList.filter(item => item > 5),
        schoolAddr: state => state.student.school.address.detail
        
    }
    })